<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>百内偶数之和</title>
</head>
<body>
    <script>
        // 总和
        var total = 0;

        for(var num = 0; num <= 100; num++){
            //偶数判断
            if(num % 2 === 0){
                //累加
                total += num;
            }
        }
        console.log('百内偶数之和为' + total);
    </script>
</body>
</html>